//
//  ZJShareClaimViewController.m
//  ShangHaiHuDongApp
//
//  Created by ZJ on 2017/6/14.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJShareClaimViewController.h"
#import "ZJShareClaimHeaderView.h"
#import "ZJSCWishTypeView.h"
#import "ZJSCLabelView.h"
#import "ZJSCExplainView.h"
#import "ZJSClaimDetailModel.h"
#import "ZJImagesScrollView.h"
#import "ZJMyStoryView.h"
#import "STPhotoBroswer.h"
@interface ZJShareClaimViewController ()<ZJImagesScrollViewDelegate>
{
    ZJSClaimDetailModel *_claimModel;
}
/** scrollView */
@property (nonatomic, strong) UIScrollView *scrollView;
/** header */
@property (nonatomic, strong) ZJShareClaimHeaderView *headerView;
/** 心愿状态 */
@property (nonatomic, strong) ZJSCWishTypeView *wishTypeView;
/** 联系方式 */
@property (nonatomic, strong) ZJSCLabelView *phoneNumber;
/** 发布日期 */
@property (nonatomic, strong) ZJSCLabelView *time;
/**  需求地址  */
@property (strong, nonatomic) ZJMyStoryView  *reqAddtessView;

/** 面向范围 */
@property (nonatomic, strong) ZJSCLabelView *faceToScopeView;
/** 需求说明 */
@property (nonatomic, strong) ZJSCExplainView *explainView;
/** 认领人姓名 */
@property (nonatomic, strong) ZJSCLabelView *claimantName;
/** 认领人电话 */
@property (nonatomic, strong) ZJSCLabelView *claimantPhoneNumber;
/** 图片 */
@property (nonatomic, strong) ZJImagesScrollView *imagesScrollView;
/** 我的故事 */
@property (nonatomic, strong) ZJMyStoryView *myStoryView;
/** 不同意理由   */
@property (nonatomic, strong) ZJMyStoryView *disAgreeRestionView;
/** 申请认领 */
@property (nonatomic, strong) UIButton *claim;
/** 代表群体 */
@property (nonatomic, strong) NSString *behalfString;

@end

@implementation ZJShareClaimViewController

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
//    [self.explainView.recordTool stopPlaying];
}

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.titlelabel.text = @"需求详情";
    self.behalfString = @"2";
    [self setupUI];
    [self netWorkingData];
}

- (void)action_leftButton:(UIButton *)sender{
    if (self.isModel) {
        [LPCostomPressentAnimationSimilarityPushAnimation backLastVc];
        [self.navigationController dismissViewControllerAnimated:NO completion:nil];
    }else{
        [self.navigationController popViewControllerAnimated:YES];
    }
}
- (void)setupUI{
    [self.view addSubview:self.scrollView];
    [self.scrollView addSubview:self.headerView];
    [self.scrollView addSubview:self.wishTypeView];
    [self.scrollView addSubview:self.phoneNumber];
    [self.scrollView addSubview:self.time];
    [self.scrollView addSubview:self.reqAddtessView];
    [self.scrollView addSubview:self.faceToScopeView];
    [self.scrollView addSubview:self.claimantName];
    [self.scrollView addSubview:self.claimantPhoneNumber];
    [self.scrollView addSubview:self.disAgreeRestionView];
    [self.scrollView addSubview:self.imagesScrollView];
    [self.scrollView addSubview:self.explainView];
    [self.scrollView addSubview:self.claim];
    [self.scrollView addSubview:self.myStoryView];
    [self.scrollView addSubview:self.disAgreeRestionView];
    
    self.reqAddtessView.sd_layout
    .topSpaceToView(self.time, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.reqAddtessView.height);

    
    self.faceToScopeView.sd_layout
    .topSpaceToView(self.reqAddtessView, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.faceToScopeView.height);
    
    self.explainView.sd_layout
    .topSpaceToView(self.faceToScopeView, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.explainView.height);
    
    self.myStoryView.sd_layout
    .topSpaceToView(self.explainView, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.myStoryView.height);
    
    self.claimantName.sd_layout
    .topSpaceToView(self.myStoryView, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.claimantName.height);
    
    self.claimantPhoneNumber.sd_layout
    .topSpaceToView(self.claimantName, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.claimantPhoneNumber.height);
    
    self.disAgreeRestionView.sd_layout
    .topSpaceToView(self.claimantPhoneNumber, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.disAgreeRestionView.height);
    
    self.imagesScrollView.sd_layout
    .topSpaceToView(self.disAgreeRestionView, 0)
    .leftEqualToView(self.explainView)
    .rightEqualToView(self.explainView)
    .heightIs(self.imagesScrollView.height);
    
    self.claim.sd_layout
    .topSpaceToView(self.imagesScrollView, 60 * [UIScreen zj_screenWScale])
    .leftSpaceToView(self.scrollView, 35 * [UIScreen zj_screenWScale])
    .widthIs(self.claim.width)
    .heightIs(self.claim.height);
    
    [self.scrollView setupAutoContentSizeWithBottomView:self.claim bottomMargin:50 * [UIScreen zj_screenHScale]];
}


//需求详情
- (void)netWorkingData{
   
    [YJProgressHUD showMessage:@"加载中..." duration:10 view:self.view];
    __weak typeof(self) weakSelf = self;
    NSString *RQ_ID;
    NSString *RL_ID;
    if (self.model.RLID.length != 0) {
        RQ_ID = @"";
        RL_ID = self.model.RLID;
    }else{
        RQ_ID = self.model.ID;
        RL_ID = @"";
    }
    NSDictionary *dict = @{@"RQ_ID":RQ_ID, @"RL_ID": RL_ID};
    [NetWorkingManager postWithUrlString:[NetWorkingURL queryReqMsg] Parameter:dict Success:^(id object) {
        [YJProgressHUD hide];
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString: @"20000"]) {
            NSArray *array = [object objectForKey:@"REQUIRE"];
            _claimModel = [ZJSClaimDetailModel yy_modelWithJSON:array.firstObject];
            [weakSelf updataUI];
        }else{
            [LYEmptyManager showLoadFailWithForScrollView:weakSelf.scrollView managerBlock:^{
                [weakSelf netWorkingData];
            }];

        }
    } Fail:^(id object) {
        [YJProgressHUD hide];
        [LYEmptyManager showLoadFailWithForScrollView:weakSelf.scrollView managerBlock:^{
            [weakSelf netWorkingData];
        }];
    }];
}


//根据数据查看视图
- (void)updataUI{
    
    if (!_claimModel || !_claimModel.ID) {//数据库没有改需求信息
        __weak typeof(self) weakSelf = self;
        UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"该需求已被删除" preferredStyle:UIAlertControllerStyleAlert];
        [alertController addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            if (weakSelf.noDataBlock) {
                weakSelf.noDataBlock(weakSelf.pushID);
            }
            [weakSelf action_leftButton:weakSelf.leftButton];
        }]];
        [self presentViewController:alertController animated:YES completion:nil];
        return;
    }
    
    if ([_claimModel.REQUIRE_TYPE isEqualToString:@"1"]) {
        self.titlelabel.text = @"个人需求";
    }else if ([_claimModel.REQUIRE_TYPE isEqualToString:@"2"]) {
        self.titlelabel.text = @"团队需求";
    }if ([_claimModel.REQUIRE_TYPE isEqualToString:@"3"]) {
        self.titlelabel.text = @"公共需求";
    }
    if ([_claimModel.TORANG integerValue] == 1) {
        self.faceToScopeView.contentLabel.text = @"面向组织";
    }
    else{
        self.faceToScopeView.contentLabel.text = @"面向个人";
    }

    [self.headerView.name setTitle:[NSString stringWithFormat:@"  %@",_claimModel.USERNAME ? _claimModel.USERNAME: @""] forState:UIControlStateNormal];
    self.headerView.titleLabel.text = _claimModel.TITLE;
    self.headerView.time.text = [NSDateFormatter formatterDateStringWithoutHourAndMinWithDateString:_claimModel.VALIDITY];
  
    self.phoneNumber.contentLabel.text = _claimModel.USERPHONE;
    self.time.contentLabel.text = _claimModel.CREATETIME;
    //需求地址
    self.reqAddtessView.string = _claimModel.ADDRESS.length > 0 ? _claimModel.ADDRESS :@"暂无地址";
    self.reqAddtessView.sd_layout
    .topSpaceToView(self.time, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.reqAddtessView.height);
    [self.reqAddtessView updateLayout];

    //需求说明
    self.explainView.string = _claimModel.CONTENT.length > 0 ? _claimModel.CONTENT :@"无说明";
    
    if (_claimModel.TAPEURL.length > 0) {//音频地址存在
        self.explainView.voiceView.hidden = NO;
        //mobile/upload/829501c1496b41d285fe9a55d309c2d5.mp3
        
        //音频文件下载
        __weak typeof(self) weakSelf = self;
        [NetWorkingManager downLoadWithUrlString:[NSString stringWithFormat:@"%@%@",BASEIMAGEURL, _claimModel.TAPEURL] success:^(NSURL *localUrlString) {
            weakSelf.explainView.recordTool.recordFileUrl = localUrlString;
            AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:localUrlString error:NULL];
            NSInteger number = player.duration / 1;
            weakSelf.explainView.voiceView.time = [NSString stringWithFormat:@"%ld",(long)number];
        }];
        self.explainView.isHaveVideo = YES;
    }else{
        self.explainView.isHaveVideo = NO;
    }
    self.explainView.sd_layout
    .topSpaceToView(self.faceToScopeView, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.explainView.height);
    [self.explainView updateLayout];
    //我的故事
     self.myStoryView.string = _claimModel.STORY.length > 0 ? _claimModel.STORY :@"无故事";
    self.myStoryView.sd_layout
    .topSpaceToView(self.explainView, 0)
    .leftSpaceToView(self.scrollView, 0)
    .rightSpaceToView(self.scrollView, 0)
    .heightIs(self.myStoryView.height);
    [self.myStoryView updateLayout];
    
     UIView *view;
    /** 需求状态(-1审核未通过,1待审核,2审核通过,3已认领。4.认领完成 5、已完成待审核) */
    
    if ([_claimModel.STATUS integerValue] == 3) {
        self.claimantPhoneNumber.hidden = YES;
        self.claimantName.hidden = YES;
        self.disAgreeRestionView.hidden = NO;
        view = self.disAgreeRestionView;
        self.disAgreeRestionView.string = _claimModel.REASON;
        self.disAgreeRestionView.sd_layout
        .topSpaceToView(self.myStoryView, 0)
        .leftSpaceToView(self.scrollView, 0)
        .rightSpaceToView(self.scrollView, 0)
        .heightIs(self.disAgreeRestionView.height);
        [self.disAgreeRestionView updateLayout];

        
    }else{
        if ([_claimModel.STATE isEqualToString:@"3"] || [_claimModel.STATE isEqualToString:@"4"] ||[_claimModel.STATE isEqualToString:@"5"]) {
            self.claimantName.contentLabel.text = _claimModel.RLUSER_NAME;
            self.claimantPhoneNumber.contentLabel.text = _claimModel.RLUSER_PHONE;
            self.claimantPhoneNumber.hidden = NO;
            self.claimantName.hidden = NO;
            self.disAgreeRestionView.hidden = YES;
            view = self.claimantPhoneNumber;
        }else if ([_claimModel.STATE isEqualToString:@"-1"]){
            self.claimantPhoneNumber.hidden = YES;
            self.claimantName.hidden = YES;
            self.disAgreeRestionView.hidden = NO;
            view = self.disAgreeRestionView;
            self.disAgreeRestionView.string = _claimModel.REASON;
            self.disAgreeRestionView.sd_layout
            .topSpaceToView(self.myStoryView, 0)
            .leftSpaceToView(self.scrollView, 0)
            .rightSpaceToView(self.scrollView, 0)
            .heightIs(self.disAgreeRestionView.height);
            [self.disAgreeRestionView updateLayout];

        }
        else{
            self.claimantPhoneNumber.hidden = YES;
            self.claimantName.hidden = YES;
            self.disAgreeRestionView.hidden = YES;
            view = self.myStoryView;
        }

    }
    
    
//    UIView *view;
//    if (self.claimantPhoneNumber.hidden) {//隐藏
//        view = self.myStoryView;
//    }else{
//        view = self.claimantPhoneNumber;
//    }
    
    //图片
    if (_claimModel.IMGJSON.count > 0) {
        self.imagesScrollView.hidden = NO;
        [self.imagesScrollView updateUI_dataArray:_claimModel.IMGJSON];
       
        self.imagesScrollView.sd_layout
        .topSpaceToView(view, 0)
        .leftEqualToView(self.explainView)
        .rightEqualToView(self.explainView)
        .heightIs(self.imagesScrollView.height);
       
    }else{
        self.imagesScrollView.hidden = YES;
        self.imagesScrollView.sd_layout
        .topSpaceToView(view, 0)
        .leftEqualToView(self.explainView)
        .rightEqualToView(self.explainView)
        .heightIs(0);
    }
    [self.imagesScrollView updateLayout];
   
    //当前用户是发布者
    if ([[NSString isNilStringReturnString:_claimModel.CREATEACCOUNT] isEqualToString:ZJUSERINFORMODEL.ORG_ACCOUNT.ID] ){
    
        if([_claimModel.STATE isEqualToString:@"3"]) {//认领完成
            [self.claim setTitle:@"认领完成" forState:UIControlStateNormal];
            self.claim.hidden = NO;
        }else{
            self.claim.hidden = YES;
        }
    }else{//当前用户不是发布者
        /** 需求状态(-1审核未通过,1待审核,2待认领,3已认领 4.认领完成) */
        if ([_claimModel.STATE isEqualToString:@"2"]) {
            if ([_claimModel.TORANG integerValue] == 1) {
                if (ZJUSERINFORMODEL.isSecretary) {
                    self.claim.hidden = NO;
                }
                else{
                    self.claim.hidden = YES;
                }
            }
            else{
                self.claim.hidden = NO;
            }
        }else{
            self.claim.hidden = YES;
        }
    }
    self.wishTypeView.type = _claimModel.STATE;
    self.wishTypeView.STATUS = _claimModel.STATUS;
    if (self.isNoShow) {
        self.claim.hidden = YES;
    }
    
}

#pragma mark - ZJImagesScrollViewDelegate(图片选择) 协议方法
- (void)ZJImagesScrollViewDelegate_index:(NSInteger)index{
    __block NSMutableArray *imageDataArray = [NSMutableArray array];
    [_claimModel.IMGJSON enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [imageDataArray addObject: [obj objectForKey:@"FILE_PATH"]];
    }];
    STPhotoBroswer *view = [[STPhotoBroswer alloc]initWithFrame:CGRectMake(0, 0,self.view.width , self.view.height) ImageArray:imageDataArray currentIndex:index];
    [view show];
}
#pragma mark - 点击事件
- (void)action_claim{
    if ([self.claim.titleLabel.text isEqualToString:@"申请认领"]) {
        if (ZJUSERINFORMODEL.isSecretary) {
            UIAlertController * alertVC = [UIAlertController alertControllerWithTitle:@"" message:@"请选择代表群体" preferredStyle:UIAlertControllerStyleActionSheet];
            UIAlertAction * personalAction = [UIAlertAction actionWithTitle:@"组织" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                self.behalfString = @"1";
                [self netWorking_claim];
            }];
            UIAlertAction * groupAction = [UIAlertAction actionWithTitle:@"个人" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                self.behalfString = @"2";
                [self netWorking_claim];
            }];
            UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
                
            }];
            [alertVC addAction:personalAction];
            [alertVC addAction:groupAction];
            [alertVC addAction:cancelAction];
            [self presentViewController:alertVC animated:YES completion:^{
                
            }];
        }
        else{
            [self netWorking_claim];
        }
    }else if ([self.claim.titleLabel.text isEqualToString:@"认领完成"]){
//        [self netWorking_ID];
        [self changeIDSTATE];
    }
    
}

//认领需求
- (void)netWorking_claim{
    __weak typeof(self) weakSelf = self;
    [YJProgressHUD show:@"认领中..." inView:self.view mode:YJProgressModeLoading];
    NSDictionary *dict = @{@"RQ_ID":self.model.ID,
                           @"USERID":[ZJUserInfoModel sharedUserInfo].CURRENT_USER_MODEL.ID,
                           @"RLUSER_NAME":[ZJUserInfoModel sharedUserInfo].ORG_ACCOUNT.USER_NAME,
                           @"RLUSER_PHONE":[ZJUserInfoModel sharedUserInfo].ORG_ACCOUNT.MOBILE,
                           @"RLUSER_PARTY":[ZJUserInfoModel sharedUserInfo].CURRENT_DEPT_MODEL.ID,
                           @"BEHALF":self.behalfString};
    [NetWorkingManager postWithUrlString:[NetWorkingURL requirementRl] Parameter:dict Success:^(id object) {
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {
            [MobClick event:[UMMStatisticsString getReq]];
            [YJProgressHUD showSuccess:@"认领成功" inview:weakSelf.view];
             [[NSNotificationCenter defaultCenter] postNotificationName:@"CALMREQUESTMENT" object:weakSelf];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//                if (self.block) {
//                    self.block();
//                }
                [weakSelf.navigationController popViewControllerAnimated:YES];
            });
        }else{
            [YJProgressHUD showSuccess:@"认领失败" inview:weakSelf.view];
        }
    } Fail:^(id object) {
          [YJProgressHUD showSuccess:@"认领失败" inview:weakSelf.view];
    }];
}

///获取接收人id
- (void)netWorking_ID{
    
    __weak typeof(self) weakSelf = self;
    NSDictionary *dict = @{@"ID":_claimModel.ID};
    [NetWorkingManager postWithUrlString:[NetWorkingURL informactionSelectShareInfo] Parameter:dict Success:^(id object) {
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {
            [weakSelf netWorking_compClaim:[object objectForKey:@"INFO_MEG"]];
        }else{
              [YJProgressHUD showSuccess:@"失败" inview:weakSelf.view];
        }
    } Fail:^(id object) {
          [YJProgressHUD showSuccess:@"失败" inview:weakSelf.view];
    }];
}

///完成认领
/** 
 formUsetDict:
    ID
	ISCOMPLETED
	SHARE_UNITID
	TO_USERID
	TO_UNITID
	CREATE_TIME

 */
- (void)netWorking_compClaim:(NSDictionary *)formUsetDict{
    /*REL_ID	项目ID
    REL_TYPE	类型   qa:QA库   jf:积分管理   pd:党员审核    resource:资源管理   act:活动  need 发布需求
    SOURCE_USERID	接受人ID
    SOURCE_UNITID	接受人机构ID
    CONTENT	内容
    FROM_USERID	发送人ID
    FROM_UNITID	发送人机构ID */
    __weak typeof(self) weakSelf = self;
    NSDictionary *dict = @{@"REL_ID":_claimModel.RLID,
                           @"REL_TYPE":@"need",
                           @"TO_USERID":[formUsetDict objectForKey:@"SOURCE_USERID"],
                           @"TO_UNITID":[formUsetDict objectForKey:@"SOURCE_UNITID"],
                           @"CONTENT":_claimModel.CONTENT,
                           @"FROM_USERID":_claimModel.CREATEUSER,
                           @"FROM_UNITID":_claimModel.UNITID};
    [NetWorkingManager postWithUrlString:[NetWorkingURL informactionSetMegSingle] Parameter:dict Success:^(id object) {
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {//完成认领
            [MobClick event:[UMMStatisticsString finishReq]];
              [YJProgressHUD showSuccess:@"确认成功" inview:weakSelf.view];
//            if (weakSelf.block) {
//                weakSelf.block();
//            }
           
             [[NSNotificationCenter defaultCenter] postNotificationName:@"CALMREQUESTMENT" object:weakSelf];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [weakSelf.navigationController popViewControllerAnimated:YES];
            });
         
        }else{
          [YJProgressHUD showSuccess:@"失败" inview:weakSelf.view];
        }
    } Fail:^(id object) {
          [YJProgressHUD showSuccess:@"失败" inview:weakSelf.view];
    }];
}
//修改状态
- (void)changeIDSTATE{
    [YJProgressHUD showMessage:@"确认中..." duration:10 view:self.view];
    __weak typeof(self) weakSelf = self;
    NSDictionary *dict = @{@"ID":_claimModel.ID,@"REL_ID": _claimModel.RLID};
    [NetWorkingManager postWithUrlString:[NetWorkingURL pbactionRequirementfinishRl] Parameter:dict Success:^(id object) {
        NetWorkModel *model = [NetWorkModel yy_modelWithJSON:object];
        if ([model.STATE isEqualToString:@"20000"]) {//完成认领
            [weakSelf netWorking_ID];
        }else{
              [YJProgressHUD showSuccess:@"失败" inview:weakSelf.view];
        }
    } Fail:^(id object) {
          [YJProgressHUD showSuccess:@"失败" inview:weakSelf.view];
    }];
}

#pragma mark - Setter


#pragma mark - Getters
- (ZJShareClaimHeaderView *)headerView{
    if (_headerView == nil){
        _headerView = [[ZJShareClaimHeaderView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 85 * [UIScreen zj_screenHScale])];
        _headerView.imageView.image = [UIImage imageNamed:@"demand_jyfw"];
    }
    return _headerView;
}
- (ZJSCWishTypeView *)wishTypeView{
    if (_wishTypeView == nil){
        _wishTypeView = [[ZJSCWishTypeView alloc] initWithFrame:CGRectMake(0, self.headerView.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"需求状态 :"];
    }
    return _wishTypeView;
}
- (ZJSCLabelView *)phoneNumber{
    if (_phoneNumber == nil){
        _phoneNumber = [[ZJSCLabelView alloc] initWithFrame:CGRectMake(0, self.wishTypeView.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"联系方式 :"];
        
    }
    return _phoneNumber;
}
- (ZJSCLabelView *)claimantName{
    if (_claimantName == nil){
        _claimantName = [[ZJSCLabelView alloc] initWithFrame:CGRectMake(0, self.wishTypeView.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"认领人 :"];
    }
    return _claimantName;
}
- (ZJSCLabelView *)claimantPhoneNumber{
    if (_claimantPhoneNumber == nil){
        _claimantPhoneNumber = [[ZJSCLabelView alloc] initWithFrame:CGRectMake(0, self.wishTypeView.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"认领人电话 :"];
        
    }
    return _claimantPhoneNumber;
}
- (ZJSCLabelView *)time{
    if (_time == nil){
        _time = [[ZJSCLabelView alloc] initWithFrame:CGRectMake(0, self.phoneNumber.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"发布时间 :"];
        
    }
    return _time;
}
- (ZJMyStoryView *)reqAddtessView{
    if (_reqAddtessView == nil){
        _reqAddtessView = [[ZJMyStoryView alloc] initWithFrame:CGRectMake(0, self.claimantPhoneNumber.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"需求地址 :"];
    }
    return _reqAddtessView;
}
- (ZJSCLabelView *)faceToScopeView{
    if (_faceToScopeView == nil){
        _faceToScopeView = [[ZJSCLabelView alloc] initWithFrame:CGRectMake(0, self.time.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"面向范围 :"];
        
    }
    return _faceToScopeView;
}
- (ZJMyStoryView *)myStoryView{
    if (_myStoryView == nil){
        _myStoryView = [[ZJMyStoryView alloc] initWithFrame:CGRectMake(0, self.time.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"需求者的故事 :"];
     
    }
    return _myStoryView;
}

- (ZJMyStoryView *)disAgreeRestionView{
    if (_disAgreeRestionView == nil){
        _disAgreeRestionView = [[ZJMyStoryView alloc] initWithFrame:CGRectMake(0, self.claimantPhoneNumber.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"不同意原因 :"];
        _disAgreeRestionView.color = [UIColor zj_colorWithHexString:@"f24141"];
    }
    return _disAgreeRestionView;
}
- (ZJSCExplainView *)explainView{
    if (_explainView == nil){
        _explainView = [[ZJSCExplainView alloc] initWithFrame:CGRectMake(0, self.time.bottom, self.view.width, 44 * [UIScreen zj_screenHScale]) title:@"需求说明 :"];
//        _explainView.string = @"我是双职工家庭，希望组织可以接小孩放学，谢谢！";
        _explainView.voiceView.hidden = YES;
    }
    return _explainView;
}

- (UIButton *)claim{
    if (_claim == nil){
        _claim = [[UIButton alloc] initWithFrame:CGRectMake(35 * [UIScreen zj_screenWScale], self.view.height - 88 * [UIScreen zj_screenHScale], self.view.width - 70 * [UIScreen zj_screenWScale], 44 * [UIScreen zj_screenHScale])];
        _claim.backgroundColor = [UIColor themeColor];
        [_claim setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_claim setTitle:@"申请认领" forState:UIControlStateNormal];
        [_claim addTarget:self action:@selector(action_claim) forControlEvents:UIControlEventTouchUpInside];
        _claim.layer.cornerRadius = 4 * [UIScreen zj_screenWScale];
        _claim.hidden  = YES;
    }
    return _claim;
}
- (UIScrollView *)scrollView{
    if (_scrollView == nil){
        _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, LP_TopHeight, self.view.width, [UIScreen zj_screenHeight] - LP_TopHeight)];
        _scrollView.contentSize = _scrollView.size;
    }
    return _scrollView;
}

- (ZJImagesScrollView *)imagesScrollView{
    if (_imagesScrollView == nil){
        _imagesScrollView = [[ZJImagesScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 120 * [UIScreen zj_screenHScale] + 1) title:@"图片 :"];
        _imagesScrollView.delegate = self;
    }
    return _imagesScrollView;
}
@end
